package com.wx.commons.utils;



import com.wx.commons.tools.IdWorker;

import java.util.UUID;

/**
* @author wx
* @Description: id工具类
* @date 2018-11-17
*/
public class IdUtils {

	private static final long DEFAULT_WORKER_ID = 11L;

	private static final long DEFAULT_DATACENTER_ID = 22L;

	private static final IdWorker idWorker = new IdWorker(DEFAULT_WORKER_ID, DEFAULT_DATACENTER_ID);

	/**
	 * 获取UUID
	 *
	 * @author wupeng
	 * @date 2018年3月24日 上午10:57:11
	 * @return String
	 */
	public static String getUUID() {
		UUID uuid = UUID.randomUUID();
		return uuid.toString().replace("-", "");
	}

	/**
	 * 获取ID
	 * 
	 * @author wupeng
	 * @date 2018/08/22 10:55:19
	 * @return String
	 */
	public static String getId() {
		return String.valueOf(idWorker.nextId());
	}
}
